
public class Main {
    public static void main(String[] args) {
        Faculty fac = new Faculty("张三", 32, "33006", 2021, 9, 1, "讲师");
        Student stu = new Student("李四", 19, "20201103", "202011");
        Staff sta = new Staff("王五", 27, "32011", 2017, 7, 23, "教务员");
        fac.show();
        sta.show();
        stu.show();
    }
}

//基类 Role
class Role {
    protected String name;       //姓名
    protected int age;
    //构造方法
    public Role() {
    }

    public Role(String name, int age) {
        this.name = name;
        this.age=age;
    }

    //Setter/Getter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    //业务方法
    public void show(){
        System.out.print("我是"+name+"，年龄"+age+"岁。");
    }
}

//派生类 Faculty 教员
class Faculty extends Role{
    String number;
    int year;
    int moon;
    int day;
    String zhiwei;
    public Faculty(String name, int age, String number, int year,int moon,int day,String zhiwei) {
        super.name = name;
        super.age = age;
        this.number = number;
        this.year = year;
        this.moon = moon;
        this.day = day;
        this.zhiwei = zhiwei;
    }

    public void show(){
        System.out.println("我是"+name+"，年龄"+age+"岁。" +"工号是"+number+"，"+year+"年"+moon+"月"+day+"日入职。是一名教师，" + zhiwei + "职称。");
    }
}
//派生类 Student 学生
class Staff extends Role{
    String number;
    int year;
    int moon;
    int day;
    String zhiwei;
    public Staff(String name, int age, String number, int year,int moon,int day,String zhiwei) {
        super.name = name;
        super.age = age;
        this.number = number;
        this.year = year;
        this.moon = moon;
        this.day = day;
        this.zhiwei = zhiwei;
    }

    public void show(){
        System.out.println("我是"+super.name+"，年龄"+super.age+"岁。" +"工号是"+number+"，"+year+"年"+moon+"月"+day+"日入职。是一名" + zhiwei + "。");
    }
}
//派生类 Staff 职员
class Student extends Role{
    String number;
    String cla;

    public Student( String name, int age, String number, String cla) {
        super.name = name;
        super.age = age;
        this.number = number;
        this.cla = cla;
    }
    public void show(){
        System.out.println("我是"+super.name+"，年龄"+super.age+"岁。" +"学号是"+number +"，来自"+cla+"班。");
    }
}